package com.authsystem.mapper;

import com.authsystem.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;

@Mapper
public interface UserMapper {

    User selectUserWithRolesByUsername(String username);

    // 修改方法，添加分页参数
    List<User> selectUsersByCondition(@Param("username") String username,
                                      @Param("email") String email,
                                      @Param("status") Integer status,
                                      @Param("name") String name,
                                      @Param("mobilephone") String mobilephone,
                                      @Param("sex") Integer sex,
                                      @Param("offset") Integer offset,
                                      @Param("pageSize") Integer pageSize);

    // 添加统计总数的方法
    Long countUsersByCondition(@Param("username") String username,
                               @Param("email") String email,
                               @Param("status") Integer status,
                               @Param("name") String name,
                               @Param("mobilephone") String mobilephone,
                               @Param("sex") Integer sex);

    Long countUsers();

    User selectByLoginnameAndPassword(@Param("loginname") String loginname,
                                      @Param("password") String password);
}